import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
  Res,
} from '@nestjs/common';
import { YuiService } from './yui.service';
import { CreateYuiDto } from './dto/create-yui.dto';
import { UpdateYuiDto } from './dto/update-yui.dto';
import { YuicService } from '../yuic/yuic.service';
import { Response } from 'express';
import { httpexception } from '../common/HttpException';
// import { YuicService } from '../yuic/yuic.service'

@Controller('yui')
export class YuiController {
  constructor(
    private readonly yuiService: YuiService,
    private readonly yuicService: YuicService,
  ) {}

  @Post()
  create(@Body() createYuiDto: CreateYuiDto) {
    return this.yuiService.create(createYuiDto);
  }

  @Get()
  findAll(@Res() res: Response) {
    res.send(this.yuicService.findAll());
    // return this.yuicService.findAll();
    // return '1111';
  }

  @Get(':id')
  findOne(@Param('id') id: string) {
    console.log(id);
    return id;
  }

  @Patch(':id')
  update(@Param('id') id: string, @Body() updateYuiDto: UpdateYuiDto) {
    return this.yuiService.update(+id, updateYuiDto);
  }

  @Delete(':id')
  remove(@Param('id') id: string) {
    return this.yuiService.remove(+id);
  }
}
